<?php
class news extends Div
{
	function __construct($args)
	{
		global $news;
		$newsData = $news->listLast(null, 'news');

		if ($newsData)
		{
            $newsFields = array();

			foreach ($newsData as $line => $info)
			{
                $info['line'] = $line;
                $newsFields[] = getThemeContent('news.html', $info);
			}
		}

		if ($_REQUEST['title'])
		{
			$result = $news->getByTitle( $_REQUEST['title'] );

            $newsFields = getThemeContent('news.html', $result);
		}

		parent::div('news', $newsFields);
	}
}
?>